package com.ruoyi.project.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.mapper.TeacherMapper;
import com.ruoyi.project.domain.Teacher;
import com.ruoyi.project.service.ITeacherService;
import com.ruoyi.common.support.Convert;

/**
 * 教师档案 服务层实现
 * 
 * @author ruoyi
 * @date 2018-11-01
 */
@Service
public class TeacherServiceImpl implements ITeacherService 
{
	@Autowired
	private TeacherMapper teacherMapper;

	/**
     * 查询教师档案信息
     * 
     * @param teacherId 教师档案ID
     * @return 教师档案信息
     */
    @Override
	public Teacher selectTeacherById(Long teacherId)
	{
	    return teacherMapper.selectTeacherById(teacherId);
	}
	
	/**
     * 查询教师档案列表
     * 
     * @param teacher 教师档案信息
     * @return 教师档案集合
     */
	@Override
	public List<Teacher> selectTeacherList(Teacher teacher)
	{
	    return teacherMapper.selectTeacherList(teacher);
	}
	
    /**
     * 新增教师档案
     * 
     * @param teacher 教师档案信息
     * @return 结果
     */
	@Override
	public int insertTeacher(Teacher teacher)
	{
	    return teacherMapper.insertTeacher(teacher);
	}
	
	/**
     * 修改教师档案
     * 
     * @param teacher 教师档案信息
     * @return 结果
     */
	@Override
	public int updateTeacher(Teacher teacher)
	{
	    return teacherMapper.updateTeacher(teacher);
	}

	/**
     * 删除教师档案对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteTeacherByIds(String ids)
	{
		return teacherMapper.deleteTeacherByIds(Convert.toStrArray(ids));
	}

	/**
	 * 根据教师姓名查询信息
	 * @param name
	 * @return
	 */
	@Override
	public Teacher selectTeachername(String name){
		Teacher teacher=new Teacher();
		teacher.setName(name);
		List<Teacher> list=teacherMapper.selectTeacherList(teacher);
		if (list!=null){
			Teacher teacher1=list.get(0);
			return teacher1;
		}else {
			return null;
		}
	}

	/**
	 * 根据身份证号码查询信息
	 * @param idnumber
	 * @return
	 */
	@Override
	public Teacher selectTeacheridnumber(int idnumber){
		Teacher teacher=new Teacher();
		teacher.setIdnumber(idnumber);
		List<Teacher> list=teacherMapper.selectTeacherList(teacher);
		if (list!=null){
			Teacher teacher1=list.get(0);
			return teacher1;
		}else {
			return null;
		}
	}

	/**
	 * 根据电话号码查询信息
	 * @param telephone
	 * @return
	 */
	@Override
	public Teacher selectTeachertelephone(String telephone){
		Teacher teacher=new Teacher();
		teacher.setTelephone(telephone);
		List<Teacher> list=teacherMapper.selectTeacherList(teacher);
		if (list!=null){
			Teacher teacher1=list.get(0);
			return teacher1;
		}else {
			return null;
		}
	}
	
}
